package ModuleFour.task04;

import java.io.Serializable;

public class User implements Serializable {

    private static final long serialVersionUID = -4322215240477925919L;
    private String userName;//自定义成员变量描述用户名
    private int passWord;//自定义成员变量描述密码

    public User() {
    }

    public User(String userName, int passWord) {
        setUserName(userName);
        setPassWord(passWord);
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getPassWord() {
        return passWord;
    }

    public void setPassWord(int passWord) {
        if (passWord > 0) {
            this.passWord = passWord;
        }else {
            System.out.println("密码不合理！");
        }
    }

    @Override
    public String toString() {
        return "User{" +
                "userName='" + userName + '\'' +
                ", passWord=" + passWord +
                '}';
    }
}
